<template>
    <svg :class="svgClass" aria-hidden="true">
      <use :xlink:href="iconName"></use>
    </svg>
</template>

<script>
  export default {
    name: 'SvgIcon',
    props:{
      className:{
        type:String,
        default:''
      },
      iconClass:{
        type:String,
        required:true
      }
    },
    computed:{
      iconName(){
        return `#icon-${this.iconClass}`
      },
      svgClass(){
        if (this.className){
          return 'svg-icon' + this.className
        }else{
          return 'svg-icon'
        }
      }
    }
  }
</script>

<style scoped lang="scss">
.svg-icon{
  width: 1em;
  height: 1em;
  fill: currentColor;
}
</style>
